#include "StdAfx.h"
#include "SkydomeParameters.h"
#include "Level.h"

#include <iostream>
#include <fstream>
#include <vector>


using namespace std;

SkydomeParameters::SkydomeParameters()
{
	m_LightDirection = D3DXVECTOR4(100.0f, 100.0f, 100.0f, 1.0f);
	m_LightColor = D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f);
	m_LightColorAmbient = D3DXVECTOR4(0.2f, 0.2f, 0.2f, 1.0f);
	m_FogDensity = 0.0003f;
	m_WaveLengths = D3DXVECTOR3(0.65f, 0.57f, 0.475f);
	m_NumSamples = 10;
	m_Exposure = -2.0f;

	setLengths();
}

SkydomeParameters::~SkydomeParameters(void)
{

}
void SkydomeParameters::SetWaveLengths(D3DXVECTOR3 wavelength)
{
	m_WaveLengths = wavelength;
	setLengths();
}

void SkydomeParameters::setLengths()
{
	m_InvWaveLengths.x = 1.0f / (float)powf((double)m_WaveLengths.x, 4.0);
	m_InvWaveLengths.y = 1.0f / (float)powf((double)m_WaveLengths.y, 4.0);
	m_InvWaveLengths.z = 1.0f / (float)powf((double)m_WaveLengths.z, 4.0);

	m_WaveLengthsMie.x = (float)powf((double)m_WaveLengths.x, -0.84);
	m_WaveLengthsMie.y = (float)powf((double)m_WaveLengths.y, -0.84);
	m_WaveLengthsMie.z = (float)powf((double)m_WaveLengths.z, -0.84);
}